<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>每日基金</title>
		<link rel="shortcut icon" href="favicon.ico">
		<!-- <script src="https://fund.eastmoney.com/pingzhongdata/000339.js?v=20160518155842"></script> -->
		<!-- <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.0/axios.min.js"></script> -->
		<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/echarts/3.8.0/echarts-en.common.min.js"></script>
		
		</script>
		<script type="text/javascript">
			
		</script>
	</head>
	<body>
		
		<button type="button">按钮</button>
		<div id="chartmain" style="width:600px; height: 400px;"></div>
	</body>
	<script type="text/javascript">
		var code = this.getQueryString("code") || '000339';
		var head = document.head || document.getElementsByTagName('head')[0];
		var script = document.createElement('script');
		script.setAttribute("src", "https://fund.eastmoney.com/pingzhongdata/" + code + ".js?v=20160518155842");
		script.setAttribute("id", "data");
		head.appendChild(script);
		// https://www.jianshu.com/p/708c915fb905
		function getQueryString(name) {
			let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			let r = window.location.search.substr(1).match(reg);
			if (r != null) {
				return decodeURIComponent(r[2]);
			};
			return null;
		}
		//https://www.cnblogs.com/Kathrine/p/13182353.html   ajax
		//指定图标的配置和数据
		var option = {
			title: {
				text: 'ECharts 数据统计'
			},
			tooltip: {},
			legend: {
				data: ['用户来源']
			},
			xAxis: {
				data: ["Android", "IOS", "PC", "Ohter"]
			},
			yAxis: {

			},
			series: [{
				name: '访问量',
				type: 'line',
				data: [500, 200, 360, 100]
			}]
		};
		//初始化echarts实例
		var myChart = echarts.init(document.getElementById('chartmain'));

		//使用制定的配置项和数据显示图表
		myChart.setOption(option);
		
		document.getElementById("data").onload = function() {
			console.log("code: "+ code +";\nstockCodes:"+stockCodes)
		}
	</script>
</html>
